<template>

	<view>
		<bg-video></bg-video>
		<cu-custom bgColor="bg-blue" :isBack="true">
			<block slot="content">门店详细</block>
		</cu-custom>
		<view class="flex justify-center text-xl bg-white  padding">
			<text>{{astore.sname}}</text>
		</view>
		<!-- 轮播图 -->
		<view>
			<swiper class="screen-swiper" :indicator-dots="false" :circular="true" :autoplay="true" interval="2000"
				duration="500">
				<swiper-item v-for="(item,index) in astore.imgs" :key="index">
					<image :src="item" mode="aspectFill"></image>
				</swiper-item>
			</swiper>
		</view>
		<view class="bg-white">
			<view class="padding text-lg">
				<text class="cuIcon-locationfill text-blue"></text>
				<text class="margin-left-xs text-sm">
					<text>{{astore.sheng}}</text>
					<text>{{astore.shi}}</text>
					<text>{{astore.qu}}</text>
					<text>{{astore.address}}</text>
				</text>
			</view>
			<view class="grid padding-sm">
				<view v-if="astore.ly" class="margin-sm flex justify-start align-center">
					<text class="text-xxl text-blue">
						<text class="iconfont icon-peitaosheshixiaotubiao_linyu text-xxl"></text>
					</text>
					<text class="margin-left-xs">淋浴</text>
				</view>
				<view v-if="astore.kt" class="margin-sm flex justify-start align-center">
					<text class="text-xxl text-blue">
						<text class="iconfont icon-kongtiao text-xxl"></text>
					</text>
					<text class="margin-left-xs">空调</text>
				</view>
				<view v-if="astore.gys" class="margin-sm flex justify-start align-center">
					<text class="text-xxl text-blue">
						<text class="iconfont icon-ziyuan text-xxl"></text>
					</text>
					<text class="margin-left-xs">更衣室</text>
				</view>
				<view v-if="astore.cs" class="margin-sm flex justify-start align-center">
					<text class="text-xxl text-blue">
						<text class="iconfont icon-weishengjian text-xxl"></text>
					</text>
					<text class="margin-left-xs">独立卫生间</text>
				</view>
				<view v-if="astore.wifi" class="margin-sm flex justify-start align-center">
					<text class="text-xxl text-blue">
						<text class="iconfont icon-wifi text-xxl"></text>
					</text>
					<text class="margin-left-xs">网络</text>
				</view>
				<view v-if="astore.yys" class="margin-sm flex justify-start align-center">
					<text class="text-xxl text-blue">
						<text class="iconfont icon-yinyongshui text-xxl"></text>
					</text>
					<text class="margin-left-xs">饮用水</text>
				</view>
			</view>

			<view>
				<view class="padding text-xl flex align-center">
					<text class="cuIcon-flashbuyfill text-blue"></text>
					<view class="margin-left-xs text">保洁：</view>
					<text class="text">{{bjmap[astore.bj]}} || '未设置' }}</text>
				</view>

				<view class="padding text-xl flex align-center">
					<text class="cuIcon-shop text-blue"></text>
					<view class="margin-left-xs text">门店类型：</view>
					<text class="text">{{mtmap[astore.storetype] || '未设置' }}</text>
				</view>

				<view class="padding text-xl flex align-center">
					<text class="cuIcon-sort text-blue"></text>
					<view class="margin-left-xs text">楼层：</view>
					<text class="text">{{flmap[astore.floor] || '未设置' }}</text>
				</view>

				<view class="padding text-xl flex align-center">
					<text class="cuIcon-more text-blue"></text>
					<view class="margin-left-xs text">面宽：</view>
					<text class="text">{{ astore.width || '未设置' }}</text>
				</view>

				<view class="padding text-xl flex align-center">
					<text class="cuIcon-titles text-blue"></text>
					<view class="margin-left-xs text">进深：</view>
					<text class="text">{{ astore.depth || '未设置' }}</text>
				</view>

				<view class="padding text-xl flex align-center">
					<text class="cuIcon-moreandroid text-blue"></text>
					<view class="margin-left-xs text">层高：</view>
					<text class="text">{{ astore.height || '未设置' }}</text>
				</view>

				<view class="padding text-xl flex align-center">
					<text class="iconfont icon-area text-blue"></text>
					<view class="margin-left-xs text">总面积：</view>
					<text class="text">{{ astore.totalarea || '未设置' }}</text>
				</view>

				<view class="padding text-xl flex align-center">
					<text class="iconfont icon-jubaohuitubiao- text-blue"></text>
					<view class="margin-left-xs text">店长：</view>
					<text class="text">{{ dz.dname || "未设置" }}</text>
				</view>

				<view class="padding text-xl flex align-center">
					<text class="iconfont icon-dianhua text-blue"></text>
					<view class="margin-left-xs text">电话：</view>
					<text class="text">{{ dz.tel || "未设置" }}</text>
				</view>
			</view>

		</view>




		<!-- 房间信息开始 -->
		<view class="bg-white margin-top-sm">
			<view class="padding solid-bottom flex justify-start align-baseline">
				<view class="text-blue title">
					<text class="text-xxl  ">
						<text class="iconfont icon-fangjian"></text>
					</text>
					<text>房间</text>
					<text class="">【{{rooms.length}}】</text>
				</view>
			</view>

			<!-- 房间列表 -->
			<view class="">
				<view class="padding-sm" v-for="(room,index) in rooms" :key="index">
					<view class="bg-white shadow radius">
						<room-item :room="room"></room-item>
					</view>
				</view>
			</view>
		</view>
		<!-- 房间信息结束 -->

	</view>
</template>

<script>
	export default {
		data: function() {
			return {
				//门店信息
				astore: {
					storeid: "", //门店id
					sname: "", //门店名
					jd: "", //经度
					wd: "", //纬度
					imgs: [],
					cover: "", //封面
					dzid: "", //店长id
					address: "",
					ly: false, //淋浴间
					kt: false, //空调
					gys: false, //更衣室
					cs: false, //卫生间
					wifi: false, //
					yys: false, //饮用水
					bj: "", //保洁
					storetype: "", //门店类型
					floor: "", //楼层
					width: "", //面宽
					depth: "", //进深
					height: "", //层高
					totalarea: "", //总面积
				},
				dz: {},

				//房间信息
				rooms: [],
				tp: {},
				func: {},
				locamap: {},
				bjmap: {},
				mtmap: {},
				flmap: {}
			};

		},

		created: function() {
			this.constant.get("ROOMFUNC").then(data => {
				this.func = data.ROOMFUNC;
			});
			this.constant.get("ROOMTP").then(data => {
				this.tp = data.ROOMTP;
			});
			this.constant.get("BJTP").then(data => {
				for (let index in data.dicts) {
					let dict = data.dicts[index];
					this.bjmap[dict.code] = dict.value;
				}
			});
			this.constant.get("MDTYPE").then(data => {
				for (let index in data.dicts) {
					let dict = data.dicts[index];
					this.mtmap[dict.code] = dict.value;
				}
			});
			this.constant.get("FLONUM").then(data => {
				for (let index in data.dicts) {
					let dict = data.dicts[index];
					this.flmap[dict.code] = dict.value;
				}
			});
			// this.locamap = this.location.localmap;
		},
		onLoad: function(option) {
			this.astore.storeid = option.storeid;
			this.getMd();
		},

		methods: {
			getMd: function() {
				this.api("/md/info/get").send({
					storeid: this.astore.storeid
				}).then(data => {
					this.astore = data.astore;
					this.astore.sheng = this.location.localmap.cmap[this.astore.pcode].criname;
					this.astore.shi = this.location.localmap.cmap[this.astore.scode].criname;
					this.astore.qu = this.location.localmap.cmap[this.astore.qcode].criname;

					for (let index in data.rooms) {
						let record = data.rooms[index];
						record.sname = this.astore.sname;
						record.sheng = this.location.localmap.cmap[this.astore.pcode].criname;
						record.shi = this.location.localmap.cmap[this.astore.scode].criname;
						record.qu = this.location.localmap.cmap[this.astore.qcode].criname;
						record.address = this.astore.address;
						record.tpname = this.tp[record.tp];
						record.funcname = this.func[record.func];
						this.rooms.push(record);
					}
					this.dz = data.adz;
				});
			},

			// 房间点击卡片处理
			toRoomInfo: function(id) {
				uni.navigateTo({
					url: `/pages/cdz/fj/detail?roomid=${id}`
				})
			},

		},

	}
</script>

<style scoped>



</style>